package top.chj.day18.genericity.demo1;

/**
 * @Auther:小陈的Java
 */
public class Person2<T> {
    private int id;
    private String name;
    private T t;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", t=" + t +
                '}';
    }

    public static void main(String[] args) {
        Person2<Integer> person1 = new Person2<Integer>();
        person1.setId(1);
        person1.setName("张");
        person1.setT(123);
        System.out.println(person1.getT());

        Person2<String> person2 = new Person2<String>();
        person2.setId(2);
        person2.setName("李");
        person2.setT("haha");
        System.out.println(person2.getT());
    }
}

